package com.icode.mvc.view;

import com.icode.mvc.exception.ViewException;
import com.icode.mvc.model.Model;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * User: Alex Zhong
 * Date: 2016/2/4
 */
public class RedirectView implements View {
    private String path;

    @Override
    public void render(HttpServletRequest request, HttpServletResponse response, Model model) throws ViewException {
        try {
            response.sendRedirect(path);
        } catch (IOException e) {
            throw new ViewException(e);
        }
    }
}
